<template>
	<view class="page_box">
		<view class="head_box ">
			<yy-custom bgColor="" v-if="0">
				<block slot="backText">返回</block>
				<block slot="content">个人中心</block>
			</yy-custom>
		</view>

		<view class="content_box ">
			<view class="head bg-img w750 h679 "></view>
			<view class="info flex justify-center pb65">
				<view class="info-inside w690 bg-white  r20 padding-lr padding-top-xl">
					<view class="flex justify-center bt">
						<text class="text-center f36 text-black text-bold">填写个人信息</text>
						<view class="w230 h12 bt-inside bg-img"></view>
					</view>
					<view class="padding-top-xl flex align-center ">
						<text class="xing"></text>
						<text class="f28 margin-left-sm text-black ">真实姓名：</text>
						<input type="text" value="" v-model="name" placeholder="请填写真实姓名" placeholder-class="ddd" />
					</view>
					<view class="padding-top-xl flex align-center ">
						<text class="xing"></text>
						<text class="f28 margin-left-sm text-black ">身份证号码：</text>
						<input type="text" value="" v-model="identity" placeholder="请填写身份证号码" placeholder-class="ddd" />
					</view>
					<view class="padding-top-xl flex align-center ">
						<text class="xing"></text>
						<text class="f28 margin-left-sm text-black ">联系电话：</text>
						<input type="number" value="" v-model="phone" placeholder="请填写联系电话" placeholder-class="ddd" />
					</view>
					<view class="padding-top-xl flex align-center ">
						<text class="xing"></text>
						<text class="f28 margin-left-sm text-black ">专 业：</text>
						<input type="text" value="" v-model="major" placeholder="请填写专业" placeholder-class="ddd" />
					</view>
					<view class="padding-top-xl flex align-center ">
						<text class="xing"></text>
						<text class="f28 margin-left-sm text-black ">身份选择：</text>
					</view>
					<view class="flex padding-tb justify-around">
						<view v-for="(item, index) in data" :key="index">
							<view class="flex" @click="click(index)">
								<image src="../../static/xuanzhe2.png" mode="aspectFill" class="w34 h34" v-if="index == c"></image>
								<image src="../../static/xuanzhe1.png" mode="aspectFill" class="w34 h34" v-else></image>
								<text class="f28 ml11">{{ item.name }}</text>
							</view>
						</view>
					</view>
					<view class="padding-top-xl flex align-center ">
						<text class="xing"></text>
						<text class="f28 margin-left-sm text-black ">所在单位：</text>
					</view>
					<view class="flex padding-tb justify-around">
						<view v-for="(item, index) in dataa" :key="index">
							<view class="flex" @click="click1(index)">
								<image src="../../static/xuanzhe2.png" mode="aspectFill" class="w34 h34" v-if="index == cc"></image>
								<image src="../../static/xuanzhe1.png" mode="aspectFill" class="w34 h34" v-else></image>
								<text class="f28 ml11">{{ item.name }}</text>
							</view>
						</view>
					</view>

					<view class="padding-top-xl flex align-center ">
						<text class="xing"></text>
						<text class="f28 margin-left-sm text-black ">单位名称：</text>
						<input type="text" value="" v-model="company_name" placeholder="请填写单位名称" placeholder-class="ddd" />
					</view>
					<button class="cu-btn btn w610 h100 r50 f36 mt20 mt50" @click="mechanism">注册</button>
					<view class="mt31 flex justify-center mb100">
						<text class="f20 text-yellow ">*你所填信息将用于后台审核不会用于其他用途,请如实填写</text>
					</view>
				</view>
			</view>
		</view>
		<view class="foot_box"></view>
		<!-- 登录提示 -->
		<yy-login v-if="false"></yy-login>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
export default {
	data() {
		return {
			c: 0,
			cc: 0,
			data: [{ name: '机构' }, { name: '专家' }, { name: '学生' }],
			dataa: [{ name: '学校' }, { name: '培训机构' }],
			company: '',
			code: '',
			
			major: '',
			company_name:'',
			name:'',
			identity:'',
			phone:'',
			
		};
	},
	onShow() {},
	onLoad(e) {},
	methods: {
		click(e) {
			this.c = e;
		},
		click1(e) {
			this.cc = e;
		},
		async mechanism() {
			if ([this.name, this.identity, this.phone, this.major, this.company_name].includes('')) {
				return this.$refs.uToast.show({ title: '请填写完整', type: 'error' });
			}
			let obj = {
				name: this.name,
				identity: this.identity,
				phone: this.phone,
				major: this.major,
				company: this.cc + 1,
				company_name: this.company_name,
				type: this.c + 1,
			};
			const res = await this.$u.post('/api/Authentication/ExpertAdd', obj, {});
			if (!res.code) return this.$refs.uToast.show({ title: res.msg, type: 'error' });
			this.$refs.uToast.show({ title: res.msg, type: 'success' });
			setTimeout(() => {
				uni.switchTab({
					url: 'hmPage',
				});
			}, 500);
		},
	},
};
</script>

<style lang="scss" scoped>
.page_box {
	.head_box {
	}
	.content_box {
		.head {
			background-image: url(https://i.loli.net/2021/05/12/WMPvLdkzYbw8GaV.png);
		}
		.info {
			width: 750rpx;
			margin-top: -5rpx;
			background: linear-gradient(#fe7003, #ffb202);
		}
		.xing::after {
			content: '*';
			color: #ff1212;
			font-size: 28rpx;
		}
		.ddd {
			font-size: 28rpx;
			font-family: PingFang SC;
		}
		input {
			width: 50vw;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
		}
		.btn {
			background-color: #fe7003;
			color: #ffffff;
		}
		.bt {
			position: relative;
			.bt-inside {
				position: absolute;
				bottom: 0;
				left: 50%;
				transform: translateX(-50%);
				background-image: url(https://i.loli.net/2021/05/12/JqTxScdG6YHjNik.png);
			}
		}
	}
}
</style>
